.class public Lcom/htc/android/footprints/view/BrightnessPanel;
.super Landroid/widget/RelativeLayout;
.source "BrightnessPanel.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/htc/android/footprints/view/BrightnessPanel$onLevelSelectListener;
    }
.end annotation


# static fields
.field private static final TAG:Ljava/lang/String; = "BrightnessPanel"


# instance fields
.field bright_desc:Landroid/view/View$OnClickListener;

.field bright_insc:Landroid/view/View$OnClickListener;

.field private mBrightDesc:Landroid/widget/ImageView;

.field private mBrightInsc:Landroid/widget/ImageView;

.field private mBrightnessData:Landroid/widget/TextView;

.field public mCameraDevice:Landroid/hardware/Camera;

.field private mContext:Landroid/content/Context;

.field mCurrentValue:I

.field mDefaultValue:I

.field public mHandler:Landroid/os/Handler;

.field private mLevelBar:Landroid/view/ViewGroup;

.field mListSelectIndex:I

.field mMax:I

.field mMin:I

.field mRange:I

.field mStep:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 44
    invoke-direct {p0, p1}, Landroid/widget/RelativeLayout;-><init>(Landroid/content/Context;)V

    .line 79
    const/4 v0, 0x0

    iput v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mListSelectIndex:I

    .line 99
    new-instance v0, Lcom/htc/android/footprints/view/BrightnessPanel$1;

    invoke-direct {v0, p0}, Lcom/htc/android/footprints/view/BrightnessPanel$1;-><init>(Lcom/htc/android/footprints/view/BrightnessPanel;)V

    iput-object v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->bright_desc:Landroid/view/View$OnClickListener;

    .line 116
    new-instance v0, Lcom/htc/android/footprints/view/BrightnessPanel$2;

    invoke-direct {v0, p0}, Lcom/htc/android/footprints/view/BrightnessPanel$2;-><init>(Lcom/htc/android/footprints/view/BrightnessPanel;)V

    iput-object v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->bright_insc:Landroid/view/View$OnClickListener;

    .line 45
    iput-object p1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mContext:Landroid/content/Context;

    .line 46
    invoke-direct {p0}, Lcom/htc/android/footprints/view/BrightnessPanel;->initView()V

    .line 47
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 38
    invoke-direct {p0, p1, p2}, Landroid/widget/RelativeLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 79
    const/4 v0, 0x0

    iput v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mListSelectIndex:I

    .line 99
    new-instance v0, Lcom/htc/android/footprints/view/BrightnessPanel$1;

    invoke-direct {v0, p0}, Lcom/htc/android/footprints/view/BrightnessPanel$1;-><init>(Lcom/htc/android/footprints/view/BrightnessPanel;)V

    iput-object v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->bright_desc:Landroid/view/View$OnClickListener;

    .line 116
    new-instance v0, Lcom/htc/android/footprints/view/BrightnessPanel$2;

    invoke-direct {v0, p0}, Lcom/htc/android/footprints/view/BrightnessPanel$2;-><init>(Lcom/htc/android/footprints/view/BrightnessPanel;)V

    iput-object v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->bright_insc:Landroid/view/View$OnClickListener;

    .line 39
    iput-object p1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mContext:Landroid/content/Context;

    .line 40
    invoke-direct {p0}, Lcom/htc/android/footprints/view/BrightnessPanel;->initView()V

    .line 41
    return-void
.end method

.method static synthetic access$000(Lcom/htc/android/footprints/view/BrightnessPanel;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 21
    invoke-direct {p0}, Lcom/htc/android/footprints/view/BrightnessPanel;->getDefault()V

    return-void
.end method

.method static synthetic access$100(Lcom/htc/android/footprints/view/BrightnessPanel;)Landroid/content/Context;
    .locals 1
    .parameter "x0"

    .prologue
    .line 21
    iget-object v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mContext:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic access$200(Lcom/htc/android/footprints/view/BrightnessPanel;)Landroid/view/ViewGroup;
    .locals 1
    .parameter "x0"

    .prologue
    .line 21
    iget-object v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mLevelBar:Landroid/view/ViewGroup;

    return-object v0
.end method

.method static synthetic access$300(Lcom/htc/android/footprints/view/BrightnessPanel;Landroid/view/ViewGroup;I)V
    .locals 0
    .parameter "x0"
    .parameter "x1"
    .parameter "x2"

    .prologue
    .line 21
    invoke-direct {p0, p1, p2}, Lcom/htc/android/footprints/view/BrightnessPanel;->refreshLevelBar(Landroid/view/ViewGroup;I)V

    return-void
.end method

.method private getDefault()V
    .locals 3

    .prologue
    const/4 v2, 0x1

    .line 160
    iget-object v1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mCameraDevice:Landroid/hardware/Camera;

    if-eqz v1, :cond_0

    .line 161
    iget-object v1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mCameraDevice:Landroid/hardware/Camera;

    invoke-virtual {v1}, Landroid/hardware/Camera;->getParameters()Landroid/hardware/Camera$Parameters;

    move-result-object v0

    .line 163
    .local v0, p:Landroid/hardware/Camera$Parameters;
    const-string v1, "brightness"

    invoke-virtual {v0, v1}, Landroid/hardware/Camera$Parameters;->get(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v1

    iput v1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mCurrentValue:I

    .line 165
    iput v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mStep:I

    .line 168
    const/16 v1, 0x9

    iput v1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mMax:I

    .line 169
    iput v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mMin:I

    .line 170
    const/4 v1, 0x5

    iput v1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mDefaultValue:I

    .line 171
    iget v1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mMax:I

    iget v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mMin:I

    sub-int/2addr v1, v2

    iput v1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mRange:I

    .line 180
    .end local v0           #p:Landroid/hardware/Camera$Parameters;
    :goto_0
    return-void

    .line 178
    :cond_0
    const-string v1, "BrightnessPanel"

    const-string v2, "no camera device"

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method private initView()V
    .locals 4

    .prologue
    .line 58
    iget-object v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mContext:Landroid/content/Context;

    const-string v3, "layout_inflater"

    invoke-virtual {v2, v3}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/LayoutInflater;

    .line 60
    .local v0, inflater:Landroid/view/LayoutInflater;
    const v2, 0x7f030003

    const/4 v3, 0x0

    invoke-virtual {v0, v2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/view/ViewGroup;

    .line 62
    .local v1, layout:Landroid/view/ViewGroup;
    invoke-virtual {p0, v1}, Lcom/htc/android/footprints/view/BrightnessPanel;->addView(Landroid/view/View;)V

    .line 63
    invoke-direct {p0}, Lcom/htc/android/footprints/view/BrightnessPanel;->getDefault()V

    .line 64
    const v2, 0x7f0c0016

    invoke-virtual {p0, v2}, Lcom/htc/android/footprints/view/BrightnessPanel;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/ImageView;

    iput-object v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mBrightDesc:Landroid/widget/ImageView;

    .line 65
    const v2, 0x7f0c0017

    invoke-virtual {p0, v2}, Lcom/htc/android/footprints/view/BrightnessPanel;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/ImageView;

    iput-object v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mBrightInsc:Landroid/widget/ImageView;

    .line 66
    const v2, 0x7f0c0014

    invoke-virtual {p0, v2}, Lcom/htc/android/footprints/view/BrightnessPanel;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/TextView;

    iput-object v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mBrightnessData:Landroid/widget/TextView;

    .line 68
    iget-object v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mBrightDesc:Landroid/widget/ImageView;

    iget-object v3, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->bright_desc:Landroid/view/View$OnClickListener;

    invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 69
    iget-object v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mBrightInsc:Landroid/widget/ImageView;

    iget-object v3, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->bright_insc:Landroid/view/View$OnClickListener;

    invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 70
    iget-object v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mBrightnessData:Landroid/widget/TextView;

    const v3, 0x7f0a0084

    invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(I)V

    .line 71
    const/4 v2, 0x1

    invoke-virtual {p0, v2}, Lcom/htc/android/footprints/view/BrightnessPanel;->setClickable(Z)V

    .line 73
    const v2, 0x7f0c0015

    invoke-virtual {p0, v2}, Lcom/htc/android/footprints/view/BrightnessPanel;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/view/ViewGroup;

    iput-object v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mLevelBar:Landroid/view/ViewGroup;

    .line 75
    return-void
.end method

.method private refreshLevelBar(Landroid/view/ViewGroup;I)V
    .locals 6
    .parameter "group"
    .parameter "idx"

    .prologue
    .line 83
    invoke-virtual {p1}, Landroid/view/ViewGroup;->getChildCount()I

    move-result v1

    .line 85
    .local v1, count:I
    const/4 v2, 0x0

    .local v2, index:I
    :goto_0
    if-ge v2, v1, :cond_0

    .line 86
    invoke-virtual {p1, v2}, Landroid/view/ViewGroup;->getChildAt(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    .line 87
    .local v0, child:Landroid/widget/ImageView;
    const v3, 0x7f020018

    invoke-virtual {v0, v3}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 85
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    .line 90
    .end local v0           #child:Landroid/widget/ImageView;
    :cond_0
    const/4 v3, 0x1

    sub-int v3, p2, v3

    invoke-virtual {p1, v3}, Landroid/view/ViewGroup;->getChildAt(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    .line 91
    .restart local v0       #child:Landroid/widget/ImageView;
    if-eqz v0, :cond_1

    const v3, 0x7f020019

    invoke-virtual {v0, v3}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 92
    :cond_1
    iget-object v3, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mBrightnessData:Landroid/widget/TextView;

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "Brightness "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 93
    return-void
.end method

.method private setBrightnessData(I)V
    .locals 1
    .parameter "level"

    .prologue
    .line 146
    iget-object v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mBrightnessData:Landroid/widget/TextView;

    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(I)V

    .line 147
    return-void
.end method


# virtual methods
.method public init(Landroid/hardware/Camera;Landroid/os/Handler;)V
    .locals 2
    .parameter "device"
    .parameter "handler"

    .prologue
    .line 183
    iput-object p1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mCameraDevice:Landroid/hardware/Camera;

    .line 184
    iput-object p2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mHandler:Landroid/os/Handler;

    .line 185
    invoke-direct {p0}, Lcom/htc/android/footprints/view/BrightnessPanel;->getDefault()V

    .line 186
    iget-object v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mLevelBar:Landroid/view/ViewGroup;

    if-eqz v0, :cond_0

    .line 187
    iget-object v0, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mLevelBar:Landroid/view/ViewGroup;

    iget-object v1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mContext:Landroid/content/Context;

    invoke-static {v1}, Lcom/htc/android/footprints/utils/FootprintUtils;->getBrightPreferences(Landroid/content/Context;)I

    move-result v1

    invoke-direct {p0, v0, v1}, Lcom/htc/android/footprints/view/BrightnessPanel;->refreshLevelBar(Landroid/view/ViewGroup;I)V

    .line 189
    :cond_0
    return-void
.end method

.method public setCameraDevice(Landroid/hardware/Camera;)V
    .locals 0
    .parameter "device"

    .prologue
    .line 50
    iput-object p1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mCameraDevice:Landroid/hardware/Camera;

    .line 51
    return-void
.end method

.method public setCameraHandler(Landroid/os/Handler;)V
    .locals 0
    .parameter "handler"

    .prologue
    .line 54
    iput-object p1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mHandler:Landroid/os/Handler;

    .line 55
    return-void
.end method

.method public showBrightPanel(I)V
    .locals 3
    .parameter "visibility"

    .prologue
    .line 135
    iget-object v1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mCameraDevice:Landroid/hardware/Camera;

    iget-object v2, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mContext:Landroid/content/Context;

    invoke-static {v2}, Lcom/htc/android/footprints/utils/FootprintUtils;->getBrightPreferences(Landroid/content/Context;)I

    move-result v2

    invoke-static {v1, v2}, Lcom/htc/android/footprints/utils/FootprintUtils;->setCameraBrightness(Landroid/hardware/Camera;I)V

    .line 137
    invoke-direct {p0}, Lcom/htc/android/footprints/view/BrightnessPanel;->getDefault()V

    .line 138
    iget-object v1, p0, Lcom/htc/android/footprints/view/BrightnessPanel;->mContext:Landroid/content/Context;

    const v2, 0x7f04000b

    invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadAnimation(Landroid/content/Context;I)Landroid/view/animation/Animation;

    move-result-object v0

    .line 140
    .local v0, pushupin:Landroid/view/animation/Animation;
    const-wide/16 v1, 0x96

    invoke-virtual {v0, v1, v2}, Landroid/view/animation/Animation;->setDuration(J)V

    .line 141
    invoke-virtual {p0, v0}, Lcom/htc/android/footprints/view/BrightnessPanel;->startAnimation(Landroid/view/animation/Animation;)V

    .line 142
    invoke-virtual {p0, p1}, Lcom/htc/android/footprints/view/BrightnessPanel;->setVisibility(I)V

    .line 143
    return-void
.end method
